package com.woniu108.carService.commons.openfeign.filter;

import com.woniu108.carService.commons.util.WebUtil;
import feign.RequestInterceptor;
import feign.RequestTemplate;

import javax.servlet.http.HttpServletRequest;

public class TokenFilter implements RequestInterceptor {
    @Override
    public void apply(RequestTemplate template) {
        HttpServletRequest request= WebUtil.getRequest();
        if(request!=null){
            String token=request.getHeader("token");
            if(token!=null){
                template.header("token",token);
            }
        }
    }
}
